package com.atues.controller;

import com.atues.annotation.SystemLog;
import com.atues.domain.ResponseResult;
import com.atues.domain.entity.SysUser;
import com.atues.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private SysUserService userService;
@GetMapping("/userInfo")
public ResponseResult userInfo(){
return userService.userInfo();
}


    @PostMapping("/avatar")
    public ResponseResult uploadAvatar(MultipartFile file){
        return userService.uploadAvatar(file);
    }

    @PutMapping("/userInfo")
    @SystemLog(businessName = "更新用户信息")
    public ResponseResult updateUserInfo(@RequestBody SysUser user){
        return userService.updateUserInfo(user);
    }

    @PostMapping("/register")

    public ResponseResult register(@RequestBody SysUser user){
        return userService.register(user);
    }

}
